package me.baicai.weixin.identity.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import me.baicai.weixin.identity.service.ShopService;
import me.baicai.weixin.application.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@Api(tags = "商家操作：商家操作")
@RestController
public class ShopController
{

    @Autowired
    private ShopService shopService;

    @ApiOperation("代理首页")
    @PostMapping("/shop/shopIndex")
    public Result shopIndex(@RequestHeader("openid") String openid)
    {
        return shopService.shopIndex(openid);
    }


    @ApiOperation("商家店铺查看")
    @PostMapping("/shop/shop")
    public Result shop(@RequestHeader("openid") String openid,
                            @RequestParam("input") String input)
    {
        return shopService.shop(openid,input);
    }


    @ApiOperation("商家收入统计")
    @PostMapping("/shop/incomeStatistics")
    public Result incomeStatistics(@RequestHeader("openid") String openid,
                                   @RequestParam("beginDate")  String beginDate,
                                   @RequestParam("endDate")  String endDate)
    {
        return shopService.incomeStatistics(openid,beginDate,endDate);
    }


    @ApiOperation("商家单日收入订单列表")
    @PostMapping("/shop/orderStatistics")
    public Result orderStatistics(@RequestHeader("openid") String openid,
                                   @RequestParam("date")  String date)
    {

        return shopService.orderStatistics(openid,date);
    }
}
